#ifndef __SCREENBUFFERH__
#define __SCREENBUFFERH__

#include "baseactor.h"
#include "drawer.h"
#include "updater.h"
// ----------------ScreenBuffer----------------
// ScreenBuffer:
/*
 * Abstract the console into a object
 * Using OSapi to get windowsize and render
 * Construct this object to use TUI framework

 * You basicly don't need to change anything
 * all the render job is handled by drawer and LayoutRender
 */

// Instructions:
/*
 * NULL
 * Since you don't need to change this
 */

class ScreenBuffer_t
{
  public:
    ScreenBuffer_t();
    ~ScreenBuffer_t();
    Action_t GetWindowSize();
    Action_t GetWindowSize(Coord_t& coord);
    char& operator[](int i);
    char& at(int i);
    char* visit(Coord_t& CurserPos);
    char*& visit(Coord_t& CurserPos, int& ReturnValue);
    char*& getbuffer();
    Action_t Fill(char c);
    Action_t Fill(char* begin, char* end, char value);

    Coord_t _WindowSize;
    Coord_t FullScreenSize;

    Drawer drawer;
    Updater updater;
    void Display(ScreenBuffer_t* ptr_scrbuf);

    short const MAXROWS, MAXCOLS;

  private:
    char* storage;
};

extern Action_t GetWindowSize(Coord_t& coord);

#endif